package cn.iocoder.yudao.module.eval.dal.mysql.monitoring;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.eval.controller.admin.monitoring.vo.EvalMonitoringDataPageReqVO;
import cn.iocoder.yudao.module.eval.dal.dataobject.monitoring.EvalMonitoringDataDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 评价实施监控 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface EvalMonitoringDataMapper extends BaseMapperX<EvalMonitoringDataDO> {

    default PageResult<EvalMonitoringDataDO> selectPage(EvalMonitoringDataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EvalMonitoringDataDO>()
                .eqIfPresent(EvalMonitoringDataDO::getPlanId, reqVO.getPlanId())
                .eqIfPresent(EvalMonitoringDataDO::getSubjectId, reqVO.getSubjectId())
                .eqIfPresent(EvalMonitoringDataDO::getMonitorType, reqVO.getMonitorType())
                .eqIfPresent(EvalMonitoringDataDO::getMonitorStatus, reqVO.getMonitorStatus())
                .eqIfPresent(EvalMonitoringDataDO::getHandleStatus, reqVO.getHandleStatus())
                .betweenIfPresent(EvalMonitoringDataDO::getMonitorTime, reqVO.getMonitorTime())
                .betweenIfPresent(EvalMonitoringDataDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(EvalMonitoringDataDO::getId));
    }

    default List<EvalMonitoringDataDO> selectListByPlanId(Long planId) {
        return selectList(EvalMonitoringDataDO::getPlanId, planId);
    }

    default List<EvalMonitoringDataDO> selectListBySubjectId(Long subjectId) {
        return selectList(EvalMonitoringDataDO::getSubjectId, subjectId);
    }

    default List<EvalMonitoringDataDO> selectListByMonitorType(String monitorType) {
        return selectList(EvalMonitoringDataDO::getMonitorType, monitorType);
    }

    default List<EvalMonitoringDataDO> selectListByMonitorStatus(Integer monitorStatus) {
        return selectList(EvalMonitoringDataDO::getMonitorStatus, monitorStatus);
    }

    default List<EvalMonitoringDataDO> selectListByHandleStatus(Integer handleStatus) {
        return selectList(EvalMonitoringDataDO::getHandleStatus, handleStatus);
    }

    default List<EvalMonitoringDataDO> selectListByPlanIdAndMonitorType(Long planId, String monitorType) {
        return selectList(new LambdaQueryWrapperX<EvalMonitoringDataDO>()
                .eq(EvalMonitoringDataDO::getPlanId, planId)
                .eq(EvalMonitoringDataDO::getMonitorType, monitorType));
    }

}
